<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../../Template/generalTemplate.xhtml">

            <ui:define name="content">

                <h:form id="form">
                    <f:view beforePhase="#{managePromotionManagedBean.initView}">
                        <p:growl id="growl" showDetail="true" />
                        <p:panel header="Manage Promotional Price" style="height:495px;">
                            <div style="margin-top:50px;margin-left:20px;margin-right:20px;">
                                <p:dataTable id="productView" dynamic="true" emptyMessage="No Product" value="#{managePromotionManagedBean.productList}" var ="lineItem">
                                    <p:column>
                                        <f:facet name="header">Product</f:facet>
                                        #{lineItem.productName}
                                    </p:column>

                                    <p:column>
                                        <f:facet name="header">Promotional Quantity (case)</f:facet>
                                        #{lineItem.promotionQuantity}
                                    </p:column>                                   
                                    
                                    <p:column>
                                        <f:facet name="header">Promotional Price</f:facet>
                                        <p:inplace editor="true" onEditUpdate="productView">
                                            <p:inputText value="#{lineItem.promotionPrice}" />
                                        </p:inplace>
                                    </p:column>   
                                </p:dataTable>
                                <br /> 
                                <p:commandButton value="Save" update="growl productView" actionListener="#{managePromotionManagedBean.save}" rendered="#{managePromotionManagedBean.canEdit}" />
                            </div>
                        </p:panel>
                    </f:view>
                </h:form>

            </ui:define>


        </ui:composition>

    </body>
</html>
